﻿#ifndef DAMETHODEDITORGRAPHICSVIEW_H
#define DAMETHODEDITORGRAPHICSVIEW_H
#include <QtCore/qglobal.h>
#include <QPointer>
#include <QUndoStack>
#include "DAGraphicsView.h"
#include "DAProject.h"
#include "DAWorkFlowGraphicsScene.h"
#include "DAAbstractNodeWidget.h"

namespace DA
{

/**
 * @brief 用于节点显示的GraphicsView
 */
class DAWorkFlowGraphicsView : public DAGraphicsView
{
    Q_OBJECT
public:
    DAWorkFlowGraphicsView(QWidget* parent = 0);
    DAWorkFlowGraphicsView(QGraphicsScene* scene, QWidget* parent = 0);
    void setProject(DAProject* project);
    void setWorkFlow(DADataWorkFlow* wf);
    DADataWorkFlow* getWorkflow();
    //激活UndoStack
    void setUndoStackActive();
    QUndoStack* getUndoStack();
    DAWorkFlowGraphicsScene* getWorkFlowGraphicsScene();
signals:

    /**
     * @brief 选中了某个节点的设置窗口
     * @param w
     */
    void selectNodeItemChanged(DA::DAAbstractNodeGraphicsItem* i);

protected:
    void keyPressEvent(QKeyEvent* event) Q_DECL_OVERRIDE;

signals:

    /**
     * @brief 节点删除
     * @param item 节点
     */
    void nodeItemDeleted(const QList< QGraphicsItem* >& items);

private:
    QPointer< DAProject > m_project;
};
}  // namespace DA
#endif  // GNODEGRAPHICSVIEW_H
